﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Wicresoft.Common;
using Wicresoft.JDPostBoard.Entity;
using System.Data;
using System.Data.SqlClient;

public partial class ejiading_List : EJDBasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
        if (!IsPostBack)
        {
            string token = Request.QueryString["tid"];
            //System.Diagnostics.EventLog.WriteEntry("application",token);
 
            //string token = "/hndlxBoQvVV8L1E/fViMQ46fcVFQScHms19gkySW3FwQdWI/3rgKgLBYtXy0AYZ";
            //string token = "9d0I5QLT5eP3CA2gvzqzrl9ohoiylyrARiLmJL6NS+3F+HJZadtc3Oxz2c1JJrTIj6TbySy+sfA=";
                            //9d0I5QLT5eP3CA2gvzqzrl9ohoiylyrARiLmJL6NS 3F HJZadtc3Oxz2c1JJrTIj6TbySy sfA=

           // Response.Write(token);
           
           // //userInfoService.PlatService u = new userInfoService.PlatService();
           // //string userXML = u.getUserInfoByTM_Token(token);
           // //userXML为接口返回的字符换，格式为XML，下面进行解析
           // //UserInfo list = CommonMethod.Instance.SerializableXML<UserInfo>(userXML);
           //// Response.Write(list.Name);
           // //对象list里面有用户的信息,真实开发中，可将信息保存至session
           // //string SearchClause = string.Format("{0}='{1}'", ApplyLog.SQLCOL_AUDITORID, list.ID);
           
           // //SearchClause += string.Format(" AND ({0}='{1}' or {0}='{2} 'or {0}='{3}' )", ApplyLog.SQLCOL_STATUS, Enum.ApplyStatusEnum.待审核.ToString(), Enum.ApplyStatusEnum.延后审核.ToString(), Enum.ApplyStatusEnum.延后审核已发货.ToString());
            
           // //int recordCount = 0;

           // //DataTable DTData = DataAccess.Select(typeof(ApplyLog), 0, 10, SearchClause, string.Format("{0} {1}", "ApplyTime", "desc"), ref recordCount);

           // string sql = "select top 10 * from ApplyLog";
           // DataSet ds = new DataSet();
           // using (SqlConnection con = new SqlConnection("Server=12.118.2.237;database=ML_APP;Persist Security Info=True;User ID=wicresoft;Password=GPDrnd01!;"))
           // {
           //     con.Open();
           //     SqlDataAdapter da = new SqlDataAdapter(sql, con);
           //     da.Fill(ds);

           // }


            string SearchClause = string.Format("{0}='{1}'", ApplyLog.SQLCOL_AUDITORID, CurrentUser.ID);

           
            SearchClause += string.Format(" AND ({0}='{1}' or {0}='{2} 'or {0}='{3}' )", ApplyLog.SQLCOL_STATUS, Enum.ApplyStatusEnum.待审核.ToString(), Enum.ApplyStatusEnum.延后审核.ToString(), Enum.ApplyStatusEnum.延后审核已发货.ToString());

           
            int recordCount = 0;
          
            DataTable DTData = DataAccess.Select(typeof(ApplyLog), 0, 10, SearchClause, string.Format("{0} {1}", "ApplyTime", "desc"), ref recordCount);
         

            //rpList.DataSource = DTData;
            //Response.Write(6);
            //rpList.DataBind();


            rpt_Master.DataSource = DTData;

            rpt_Master.DataBind();
        }
    }

    public string updateTime(object time)
    {
        try
        {
            if (time != null)
            {
                return Convert.ToDateTime(time).ToString("yyyy-MM-dd HH:mm");
            }
        }
        catch (Exception ex)
        {
            return "";
        }
        return "";
    }
}
